package com.ylbh.modules.commission.controller;

import com.ylbh.common.annotation.SysLog;
import com.ylbh.common.pojo.commission.dto.CommissionDTO;
import com.ylbh.common.pojo.commission.vo.CommissionVO;
import com.ylbh.common.utils.CommonResult;
import com.ylbh.common.utils.Ref;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.ylbh.modules.commission.service.ShoppingCommissionService;
import com.ylbh.common.utils.PageUtils;

/**
 *
 * 用户返佣
 * @author czx
 * @date 2019-12-17 20:15:02
 */
@RestController
@RequestMapping("commission")
public class ShoppingCommissionController {

    @Autowired
    private ShoppingCommissionService shoppingCommissionService;

    @ApiOperation("返佣提现列表")
    @GetMapping("/queryCommissionList")
    @RequiresPermissions("commission:queryCommissionList")
    public CommonResult queryCommissionList(CommissionDTO dto){
        PageUtils page = shoppingCommissionService.queryCommissionList(dto);
        return Ref.ok(page);
    }


    @SysLog("审核返佣提现")
    @ApiOperation("审核返佣提现")
    @PostMapping("/reviewOfWithdrawalOfCommissionById/{commissionId}")
    @RequiresPermissions("commission:reviewOfWithdrawalOfCommissionById")
    public CommonResult reviewOfWithdrawalOfCommissionById(@PathVariable("commissionId") String commissionId){
		shoppingCommissionService.reviewOfWithdrawalOfCommissionById(commissionId);
        return Ref.ok();
    }

    @ApiOperation("获取返佣详情信息")
    @GetMapping("/getCommissionDetailsInfoById")
    @RequiresPermissions("commission:getCommissionDetailsInfoById/{commissionId}")
    public CommonResult getCommissionDetailsInfoById(@PathVariable String commissionId) {
        CommissionVO vo = shoppingCommissionService.getCommissionDetailsInfoById(commissionId);
        return Ref.ok(vo);
    }

}
